package com.joven.interface4.controller;

import com.joven.interface4.config.DynamicThreadPool;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wzj
 * @Date: 2024/2/18 11:04
 */
@RestController
@RequestMapping("/threadpool")
@RequiredArgsConstructor
public class ThreadPoolController {

    private final DynamicThreadPool dynamicThreadPool;

    @GetMapping("/print")
    public String printThreadPoolStatus() {
        return dynamicThreadPool.printThreadPoolStatus();
    }

    @GetMapping("/add")
    public String dynamicThreadPoolAddTask(int count) {
        dynamicThreadPool.dynamicThreadPoolAddTask(count);
        return String.valueOf(count);
    }
}
